import { request } from '@ruifox-cms/utils'

// 获取问卷类型列表
export function getFormTypeList(params) {
    return request({
        baseURL: process.env.NODE_ENV == 'development' ? '/form_api' : '/api',
        url: '/form/api/paperType/selectList',
        method: 'get',
        params
    })
}
// 获取问卷管理列表
export function getFormManageList(params) {
    return request({
        baseURL: process.env.NODE_ENV == 'development' ? '/form_api' : '/api',
        url: '/form/api/paper/selectPage',
        method: 'get',
        params
    })
}
// 获取当前可用题型
export function getCurComponentList(params) {
    return request({
        baseURL: process.env.NODE_ENV == 'development' ? '/form_api' : '/api',
        url: '/form/api/paperType/select',
        method: 'get',
        params
    })
}
// 获取所有组件列表
export function getComponentList(params) {
    return request({
        baseURL: process.env.NODE_ENV == 'development' ? '/form_api' : '/api',
        url: '/form/api/paperComponent/selectList',
        method: 'get',
        params
    })
}
// 获取题库（我的题库）
export function getMyBank(params) {
    return request({
        baseURL: process.env.NODE_ENV == 'development' ? '/form_api' : '/api',
        url: '/form/api/paperBank/selectListByPrivate',
        method: 'get',
        params
    })
}

// 获取题库（公共题库）
export function getPublicBank(params) {
    return request({
        baseURL: process.env.NODE_ENV == 'development' ? '/form_api' : '/api',
        url: '/form/api/paperBank/selectListByPublic',
        method: 'get',
        params
    })
}
// 表单发布
export function formPublish(data) {
    return request({
        baseURL: process.env.NODE_ENV == 'development' ? '/form_api' : '/api',
        url: '/form/api/paper/insert',
        method: 'post',
        data
    })
}
// 获取预定义选项 
export function getPresupposeOption(params) {
    return request({
        baseURL: process.env.NODE_ENV == 'development' ? '/form_api' : '/api',
        url: '/form/api/paperBank/getPresupposeOption',
        method: 'get',
        params
    })
}
// 我的问卷发布量
export function myQsStatistics() {
    return request({
        baseURL: process.env.NODE_ENV == 'development' ? '/form_api' : '/api',
        url: '/form/api/paper/getStatistics',
        method: 'get',
    })
}
// 获取自定义来源
export function getCustomSource(params) {
    return request({
        baseURL: process.env.NODE_ENV == 'development' ? '/form_api' : '/api',
        url: '/form/api/paperSource/selectList',
        method: 'get',
        params
    })
}
// 获取当前表单模板信息
export function getCurFormInfo(params) {
    return request({
        baseURL: process.env.NODE_ENV == 'development' ? '/form_api' : '/api',
        url: '/form/api/paper/select',
        method: 'get',
        params
    })
}
// 获取表单统计
export function getFormStatistics(data, params) {
    return request({
        baseURL: process.env.NODE_ENV == 'development' ? '/form_api' : '/api',
        url: '/form/api/paper/getPaperStatistics',
        method: 'post',
        data,
        params
    })
}
// 获取分析统计（表格形式）
export function getFormAnalysisData(data, params) {
    return request({
        baseURL: process.env.NODE_ENV == 'development' ? '/form_api' : '/api',
        url: '/form/api/paper/getAnalysis',
        method: 'post',
        data,
        params
    })
}
// 添加题目（我的题库）
export function addMyBankQs(data) {
    return request({
        baseURL: process.env.NODE_ENV == 'development' ? '/form_api' : '/api',
        url: '/form/api/paperBank/insertQuestion',
        method: 'post',
        data
    })
}
//批量添加题目
export function insertQuestionBatch(data) {
    return request({
        baseURL: process.env.NODE_ENV == 'development' ? '/form_api' : '/api',
        url: '/form/api/paperBank/insertQuestionBatch',
        method: 'post',
        data
    })
}
// 修改题目（我的题库）
export function editMyBankQs(data) {
    return request({
        baseURL: process.env.NODE_ENV == 'development' ? '/form_api' : '/api',
        url: '/form/api/paperBank/updateQuestion',
        method: 'post',
        data
    })
}
// 删除题目（我的题库）
export function deleteMyBankQsByIds(data) {
    return request({
        baseURL: process.env.NODE_ENV == 'development' ? '/form_api' : '/api',
        url: '/form/api/paperBank/deleteListQuestion',
        method: 'delete',
        data
    })
}
//修改题目的题库
export function updateBank(data) {
    return request({
        baseURL: process.env.NODE_ENV == 'development' ? '/form_api' : '/api',
        url: '/form/api/paperQuestion/updateBank',
        method: 'post',
        data
    })
}
//批量修改题目的题库
export function updateBankBatch(data) {
    return request({
        baseURL: process.env.NODE_ENV == 'development' ? '/form_api' : '/api',
        url: '/form/api/paperQuestion/updateBankBatch',
        method: 'post',
        data
    })
}
//查询分组的题目
export function selectBankQuestionPage(params) {
    return request({
        baseURL: process.env.NODE_ENV == 'development' ? '/form_api' : '/api',
        url: '/form/api/paperBank/selectBankQuestionPage',
        method: 'get',
        params
    })
}
//查询所有题目
export function selectAllQuestion(params) {
    return request({
        baseURL: process.env.NODE_ENV == 'development' ? '/form_api' : '/api',
        url: '/form/api/paperBank/selectAllQuestion',
        method: 'get',
        params
    })
}
//根据id列表查询题目
export function selectListByIds(params) {
    return request({
        baseURL: process.env.NODE_ENV == 'development' ? '/form_api' : '/api',
        url: '/form/api/paperQuestion/selectListByIds',
        method: 'get',
        params
    })
}
// 添加分组（我的题库）
export function addMyBank(data) {
    return request({
        baseURL: process.env.NODE_ENV == 'development' ? '/form_api' : '/api',
        url: '/form/api/paperBank/insert',
        method: 'post',
        data
    })
}
// 修改分组（我的题库）
export function editMyBank(data) {
    return request({
        baseURL: process.env.NODE_ENV == 'development' ? '/form_api' : '/api',
        url: '/form/api/paperBank/rename',
        method: 'post',
        data
    })
}
// 删除分组（我的题库）
export function deleteMyBankByIds(data) {
    return request({
        baseURL: process.env.NODE_ENV == 'development' ? '/form_api' : '/api',
        url: '/form/api/paperBank/deleteList',
        method: 'delete',
        data
    })
}
// 修改表单状态
export function changeFormStatus(data) {
    return request({
        baseURL: process.env.NODE_ENV == 'development' ? '/form_api' : '/api',
        url: '/form/api/paper/updateState',
        method: 'post',
        data
    })
}
// 表单收藏
export function formCollect(data) {
    return request({
        baseURL: process.env.NODE_ENV == 'development' ? '/form_api' : '/api',
        url: '/form/api/paper/collect',
        method: 'post',
        data
    })
}
// 表单编辑
export function formEdit(data) {
    return request({
        baseURL: process.env.NODE_ENV == 'development' ? '/form_api' : '/api',
        url: '/form/api/paper/update',
        method: 'post',
        data
    })
}
// 表单删除
export function formDelete(data) {
    return request({
        baseURL: process.env.NODE_ENV == 'development' ? '/form_api' : '/api',
        url: '/form/api/paper/delete',
        method: 'delete',
        data
    })
}
// 暂存
export function formStaging(data) {
    return request({
        baseURL: process.env.NODE_ENV == 'development' ? '/form_api' : '/api',
        url: '/form/api/paper/insertStaging',
        method: 'post',
        data
    })
}
// 获取表单答卷详情
export function getAnswerDetail(params) {
    return request({
        baseURL: process.env.NODE_ENV == 'development' ? '/form_api' : '/api',
        url: '/form/api/paperResult/select',
        method: 'get',
        params
    })
}
// 删除表单答卷详情
export function deleteAnswerByIds(data) {
    return request({
        baseURL: process.env.NODE_ENV == 'development' ? '/form_api' : '/api',
        url: '/form/api/paperResult/deleteList',
        method: 'delete',
        data
    })
}
// 清空数据
export function clearFormStatistics(data) {
    return request({
        baseURL: process.env.NODE_ENV == 'development' ? '/form_api' : '/api',
        url: '/form/api/paperResult/clear',
        method: 'delete',
        data
    })
}
// 更新答卷状态
export function updatePaperResultState(data) {
    return request({
        baseURL: process.env.NODE_ENV == 'development' ? '/form_api' : '/api',
        url: '/form/api/paperResult/updateState',
        method: 'post',
        data
    })
}
// 回收站恢复
export function formRestore(data) {
    return request({
        baseURL: process.env.NODE_ENV == 'development' ? '/form_api' : '/api',
        url: '/form/api/paper/restore',
        method: 'post',
        data
    })
}
// 回收站删除
export function recycleDelete(data) {
    return request({
        baseURL: process.env.NODE_ENV == 'development' ? '/form_api' : '/api',
        url: '/form/api/paper/recycleDelete',
        method: 'delete',
        data
    })
}
// 获取操作记录
export function getFormOperationLog(params) {
    return request({
        baseURL: process.env.NODE_ENV == 'development' ? '/form_api' : '/api',
        url: '/form/api/paper/getFormOperationLog',
        method: 'get',
        params
    })
}
/*******************************php接口 ******************************/


// 推荐外观
export function getRecommendAppearance(params) {
    return request({
        baseURL: process.env.NODE_ENV == 'development' ? '/form_api' : '/api',
        url: '/form/api/paperAppearance/selectPublic',
        method: 'get',
        params
    })
}
// 我的外观
export function getMyAppearance(params) {
    return request({
        baseURL: process.env.NODE_ENV == 'development' ? '/form_api' : '/api',
        url: '/form/api/paperAppearance/selectPrivate',
        method: 'get',
        params
    })
}
// 保存我的外观
export function saveMyAppearance(data) {
    return request({
        baseURL: process.env.NODE_ENV == 'development' ? '/form_api' : '/api',
        url: '/form/api/paperAppearance/insert',
        method: 'post',
        data
    })
}
// 获取推荐页眉图片
export function getRecommendHeaderImg(params) {
    return request({
        baseURL: process.env.NODE_ENV == 'development' ? '/form_api' : '/api',
        url: '/formDesign/getRecommendHeaderImg',
        method: 'get',
        params
    })
}
// 获取推荐背景图片
export function getRecommendBackImg(params) {
    return request({
        baseURL: process.env.NODE_ENV == 'development' ? '/form_api' : '/api',
        url: '/formDesign/getRecommendBackImg',
        method: 'get',
        params
    })
}
// 获取登陆地址
export function getLoginAddress(params) {
    return request({
        baseURL: process.env.NODE_ENV == 'development' ? '/form_api' : '/api',
        url: '/formDesign/getLoginAddress',
        method: 'get',
        params
    })
}
// 获取指定角色列表
export function getRoleLists(params) {
    return request({
        baseURL: process.env.NODE_ENV == 'development' ? '/form_api' : '/api',
        url: '/formDesign/getRoleLists',
        method: 'get',
        params
    })
}
// 获取IP段白名单
export function getIpWhiteList(params) {
    return request({
        baseURL: process.env.NODE_ENV == 'development' ? '/form_api' : '/api',
        url: '/formDesign/getIpWhiteList',
        method: 'get',
        params
    })
}
//获取访问权限验证列表
export function getPermissionList(params) {
    return request({
        baseURL: process.env.NODE_ENV == 'development' ? '/form_api' : '/api',
        url: '/formDesign/getPermissionList',
        method: 'get',
        params
    })
}


// 获取表单分享基本信息（标题、二维码、链接）
export function getShareInfo(params) {
    return request({
        baseURL: process.env.NODE_ENV == 'development' ? '/form_api' : '/api',
        url: '/form/api/paper/getShareInfo',
        method: 'get',
        params
    })
}

// 获取来源随机链接
export function getRandomLink(params) {
    return request({
        baseURL: process.env.NODE_ENV == 'development' ? '/form_api' : '/api',
        url: '/formShare/getRandomLink',
        method: 'get',
        params
    })
}
// 添加自定义来源
export function addCustomSource(data) {
    return request({
        baseURL: process.env.NODE_ENV == 'development' ? '/form_api' : '/api',
        url: '/form/api/paperSource/insert',
        method: 'post',
        data
    })
}
// 更新自定义来源
export function updateCustomSource(data) {
    return request({
        baseURL: process.env.NODE_ENV == 'development' ? '/form_api' : '/api',
        url: '/form/api/paperSource/update',
        method: 'post',
        data
    })
}
// 删除自定义来源
export function deleteCustomSource(data) {
    return request({
        baseURL: process.env.NODE_ENV == 'development' ? '/form_api' : '/api',
        url: '/form/api/paperSource/delete',
        method: 'delete',
        data
    })
}
// 审核答卷
export function answerAudit(data) {
    return request({
        baseURL: process.env.NODE_ENV == 'development' ? '/form_api' : '/api',
        url: '/formManage/answerAudit',
        method: 'post',
        data
    })
}
// 答卷打分
export function answerRate(data) {
    return request({
        baseURL: process.env.NODE_ENV == 'development' ? '/form_api' : '/api',
        url: '/formManage/answerRate',
        method: 'post',
        data
    })
}
// 表单设置更新
export function updatePublishSetting(data) {
    return request({
        baseURL: process.env.NODE_ENV == 'development' ? '/form_api' : '/api',
        url: '/form/api/paper/updateSetting',
        method: 'post',
        data
    })
}





//获取方正黑体
export function getFangZhengHeiTi(params) {
    return request({
        baseURL: process.env.NODE_ENV == 'development' ? '/form_api' : '/api',
        url: '/statistics/getFangZhengHeiTi',
        method: 'get',
        params
    })
}
